<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../gsap.min.js"></script>
  <script src="../gsap-public/minified/ScrollTrigger.min.js"></script>
  <script src="../gsap-public/minified/ScrollToPlugin.min.js"></script>
  <style>
    .content {
      display: flex;
      overflow-x: auto;
    }
    .box {
      flex-shrink: 0;
      width: 100vw;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 32px;
    }

    .blue {
      background-color: blue;
    }

    .green {
      background-color: green;
    }

    .pink {
      background-color: pink;
    }

    .yellow {
      background-color: yellow;
    }

    .red {
      background-color: red;
    }

    .gray {
      background-color: gray;
    }
  </style>
</head>

<body>
  <div class="content">


    <div class="box blue">blue</div>
    <div class="box green">green</div>
    <div class="box pink">pink</div>
    <div class="box yellow">yellow</div>
    <div class="box red">red</div>
    <div class="box gray">gray</div>
  </div>
  <script>
    gsap.registerPlugin(ScrollTrigger);
    // ScrollTrigger.create({
    //   trigger: '.box',
    //   start: 'top top',
    //   end: '+=600px',
    //   pinSpacing: false,
    //   pin: true,
    // });
    const sections = gsap.utils.toArray('.box');
    sections.forEach((panel, i) => {
      ScrollTrigger.create({
        xPercent: -100 * (sections.length - 1),
        trigger: panel,
        start: 'top top',
        pin: true,
        pinSpacing: false,
        end: '+=3500'
      });
    });
  </script>
</body>

</html>